package com.study04;
/*
* 在接口里面创建2个抽象方法
* 在每一个类里面实现周长和面积的计算
*
* */

public class Rectangle implements Count {
    double width;
    double height;
    String shape;
    double[] arr;

    Rectangle(){};
    Rectangle(double[] arr){
        this.width = arr[0];
        this.height = arr[1];
        this.arr = arr;
        if (arr[0] == arr[1]){
            this.shape = "正方形";
        }else {
            this.shape = "长方形";
        }
    }

    @Override
    public double perimeter() {
        return (this.width+this.height)*2;
    }

    @Override
    public double area() {
        return this.width * this.height;
    }
    public void printParam(){
        for (int i = 0; i < this.arr.length ; i++) {
            System.out.println(this.arr[i]);
        }
    }
}
